package com.libinshen.wxpay.login.controller;

import com.libinshen.wxpay.common.vo.CommonResult;
import com.libinshen.wxpay.login.service.SmsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/***
 * J集成阿里云短信第三方接口
 * 集成腾讯云短信第三方接口
 */
@Api(tags = "阿里云短信登录接口")
@RestController
@RequestMapping("/sms")
@Slf4j
public class SmsLogin {

    @Autowired
    private SmsService smsService;

    /***
     *短信验证码登录
     * @param phone
     * @return
     */
    @ApiOperation("短信验证码登录->通过手机获取验证码。测试完成")
    @GetMapping("/smsLogin")
    public CommonResult smsLogin(String phone) {
        smsService.smsLogin(phone);
        return CommonResult.success(true);
    }

    @ApiOperation("短信验证码登录->校验验证码是否正确。测试完成完成")
    @GetMapping("/verifyCode")
    public CommonResult verifyCode(String phone, String code) {
        smsService.verifyCode(phone, code);
        return CommonResult.success(true);
    }
}
